<template>
<div>
    <div>
      <van-nav-bar title="个人中心" /> 
    </div>    
    <div align="center">
        <p>welcome{{uN}}</p>
    </div>
    <div>
        <div id="btn" align="center" v-if="!LoginState">
            <van-button type="primary" style="margin:10px" @click='ToLogin'>登录注册</van-button>
            <van-button style="margin:10px" @click='ToFindPSW'>找回密码</van-button>
        </div>
    </div>
    <div v-if="LoginState">
        <van-cell-group >
            <van-cell title="个人信息" icon="contact" is-link to='/userMsg'/>
            <van-cell title="我的发布" icon="records" @click="mygoods" is-link/>
            <van-cell title="收藏夹" icon="tosend" is-link to='/colletion'/>
        </van-cell-group>
        <br>
         <van-cell-group>
            <van-cell title="修改密码" icon="edit" is-link to='/findPsw'/>
            <van-cell title="设置" icon="setting" is-link to='/setting'/>
            <van-cell title="注销登录" icon="close" @click='ToQuit' is-link />
        </van-cell-group>
    </div>
    
</div>
</template>
<script>
export default {
   data(){
        return{
        }
    },
    computed:{
        LoginState(){
        return this.$store.state.LoginState
        },
        uN(){
            return this.$store.state.uN
        }
    },
   methods: {
    //注销登录
    ToQuit(){
        window.localStorage.clear();
        this.$store.commit('logout');
        this.$router.push('/login');
        this.$store.commit('Nodeal');
    },
    mygoods(){
        this.$store.commit('login');
        this.$router.push('/mygoods');
    },
    //登录注册
    ToLogin() {
        this.$router.push('/login')
        },
     //忘记密码
    ToFindPSW(){this.$router.push('/findPsw')},
  
   }, 
}
</script>
<style>

</style>
